# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: poplarch <poplarch@gmail.com>

pkgname=fcitx-libpinyin
pkgver=0.5.4
_model=model.text.20161206.tar.gz
pkgrel=2
pkgdesc="Fcitx Wrapper for libpinyin, Library to deal with pinyin"
arch=('loong64' 'x86_64')
url="https://github.com/fcitx/fcitx-libpinyin"
license=('GPL')
depends=('fcitx' 'libpinyin' 'fcitx-qt5' 'qt5-webengine')
makedepends=('cmake')
source=("https://download.fcitx-im.org/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig}
        "https://download.fcitx-im.org/data/$_model"{,.sig})
sha512sums=('7d1d31293f4be564e550b89f1037b6500fbc309b198f7e2dbe621f5447f7b1ce7982eef70f266eaffe11bbf978486b506bca33f803e1c5ab0858c41c254c4654'
            'SKIP'
            '26450e347b7a211e5abd94acbb9befc8cee7d8fc20e5161ef11b8b9b1ad47cde4f1add5c41484d9af04e4dde2aa748090e297e799ee7f6d2f9fcec3873eee429'
            'SKIP')
validpgpkeys=('2CC8A0609AD2A479C65B6D5C8E8B898CBF2412F9') # Weng Xuetian <wengxt@gmail.com>

prepare() {
  mkdir build
  ln -s "$srcdir"/$pkgname-$_model fcitx-libpinyin-$pkgver/data/$_model
}

build() {
  cd build

  cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release ../$pkgname-$pkgver
  make
}

package() {
  cd build
  make DESTDIR="$pkgdir" install
}
